home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / XLIBP202.ZIP / XLIBDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1994-06-16  |  18KB  |  515 lines

  1. { VERY QUICK AND ULTRA-DIRTY DEMO USING XLIB
  2.     Simple Demo of MODE X Split screen and panning
  3.     Compile using Borland/Turbo Pascal 6.0/7.0 }
  4.  
  5. {$IFDEF DPMI}
  6. {$C FIXED PRELOAD PERMANENT}
  7. {$ENDIF}
  8.  
  9. Program Xlibdemo;
  10.  
  11. Uses
  12.     Crt, XLib2, xbm2;
  13.  
  14. Const
  15.     MaxObjects = 10;
  16.     ObjectCount : integer = 0;
  17.     bm : array[0..193] of byte =
  18.         (4,12,
  19.         2,2,2,2,2,1,1,1,2,1,1,1,2,3,3,1,
  20.         2,0,0,3,2,0,0,3,2,0,0,3,2,0,0,3,
  21.         2,3,3,1,2,1,1,1,2,1,1,1,2,2,2,2,
  22.         2,2,2,2,1,1,1,1,1,1,1,1,1,3,3,1,
  23.         1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,
  24.         1,3,3,1,1,1,1,1,1,1,1,1,2,2,2,2,
  25.         2,2,2,2,1,1,1,1,1,1,1,1,1,3,3,1,
  26.         1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,
  27.         1,3,3,1,1,1,1,1,1,1,1,1,2,2,2,2,
  28.         2,2,2,2,1,1,1,2,1,1,1,2,1,3,3,2,
  29.         3,0,0,2,3,0,0,2,3,0,0,2,3,0,0,2,
  30.         1,3,3,2,1,1,1,2,1,1,1,2,2,2,2,2 );
  31.  
  32.     bm2 : array[0..193] of byte =
  33.         (4,12,
  34.         2,2,2,2,2,4,4,4,2,4,4,4,2,2,2,4,
  35.         2,0,0,2,2,0,0,2,2,0,0,2,2,0,0,2,
  36.         2,2,2,4,2,4,4,4,2,4,4,4,2,2,2,2,
  37.         2,2,2,2,4,4,4,4,4,4,4,4,4,2,2,4,
  38.         4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,
  39.         4,2,2,4,4,4,4,4,4,4,4,4,2,2,2,2,
  40.         2,2,2,2,4,4,4,4,4,4,4,4,4,2,2,4,
  41.         4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,
  42.         4,2,2,4,4,4,4,4,4,4,4,4,2,2,2,2,
  43.         2,2,2,2,4,4,4,2,4,4,4,2,4,2,2,2,
  44.         2,0,0,2,2,0,0,2,2,0,0,2,2,0,0,2,
  45.         4,2,2,2,4,4,4,2,4,4,4,2,2,2,2,2);
  46.  
  47.     palscrolldir : integer = 1;
  48.     textwindowx : integer = 0;
  49.     textwindowy : integer = 0;
  50. Type
  51.     AnimatedObject = record
  52.         X,Y,Width,Height,XDir,YDir,XOtherPage,YOtherPage : integer;
  53.         Image, bg, bgOtherPage : pointer;
  54.     end;
  55.  
  56. Var
  57.     objects : array[0..MaxObjects] of AnimatedObject;
  58.     userfnt1, pal, pal2, SaveExitProc : pointer;
  59.     xpos : integer;
  60.  
  61. procedure initobject( x, y, width, height, xdir, ydir : integer;
  62.                                             var image : pointer );
  63. begin
  64.     objects[objectcount].X := x;
  65.     objects[objectcount].XOtherPage := x;
  66.     objects[objectcount].Y := y;
  67.     objects[objectcount].YOtherPage := y;
  68.     objects[objectcount].Width := width;
  69.     objects[objectcount].Height := height;
  70.     objects[objectcount].XDir := xdir;
  71.     objects[objectcount].YDir := ydir;
  72.     objects[objectcount].Image := image;
  73.     GetMem( objects[objectcount].bg, 4*width*height+20);
  74.     GetMem( objects[objectcount].bgOtherPage, 4*width*height+20);
  75.     xgetpbm(x,y,width,height,VisiblePageOffs, objects[objectcount].bg^);
  76.     xgetpbm(x,y,width,height,HiddenPageOffs, objects[objectcount].bgOtherPage^);
  77.     inc(objectcount);
  78. end;
  79.  
  80. procedure MoveObject( var ObjectToMove : AnimatedObject );
  81. var
  82.     X, Y : integer;
  83.     cptr : pointer;
  84. begin
  85.     X := ObjectToMove.X + ObjectToMove.XDir;
  86.     Y := ObjectToMove.Y + ObjectToMove.YDir;
  87.     if (X < 0) or (X > (ScrnLogicalPixelWidth-(ObjectToMove.Width shl 2))) then
  88.     begin
  89.         ObjectToMove.XDir := -ObjectToMove.XDir;
  90.         X := ObjectToMove.X + ObjectToMove.XDir;
  91.      end;
  92.     if (Y < 0) or (Y > (ScrnLogicalHeight-ObjectToMove.Height)) then
  93.     begin
  94.         ObjectToMove.YDir := -ObjectToMove.YDir;
  95.         Y := ObjectToMove.Y + ObjectToMove.YDir;
  96.     end;
  97.     ObjectToMove.XOtherPage := ObjectToMove.X;
  98.     ObjectToMove.YOtherPage := ObjectToMove.Y;
  99.     ObjectToMove.X := X;
  100.     ObjectToMove.Y := Y;
  101.     cptr := ObjectToMove.bg;
  102.     ObjectToMove.bg := ObjectToMove.bgOtherPage;
  103.     ObjectToMove.bgOtherPage := cptr;
  104. end;
  105.  
  106. procedure animate;
  107. var
  108.     i : integer;
  109. begin
  110.     for i:=objectcount-1 downto 0 do
  111.         xputpbm(objects[i].XOtherPage,objects[i].YOtherPage,
  112.             HiddenPageOffs,objects[i].bgOtherPage^);
  113.     for i:=0 to objectcount-1 do
  114.     begin
  115.         MoveObject(objects[i]);
  116.         xgetpbm(objects[i].X,objects[i].Y,
  117.             objects[i].Width,objects[i].Height,HiddenPageOffs,
  118.             objects[i].bg^);
  119.         xputmaskedpbm(objects[i].X,objects[i].Y,HiddenPageOffs,
  120.             objects[i].Image^);
  121.  end;
  122. end;
  123.  
  124. procedure clearobjects;
  125. var
  126.     i : integer;
  127. begin
  128.     for i:=objectcount-1 downto 0 do
  129.         xputpbm(objects[i].XOtherPage,objects[i].YOtherPage,
  130.             HiddenPageOffs,objects[i].bgOtherPage^);
  131. end;
  132.  
  133.  
  134. procedure textwindow( Margin : integer );
  135. var
  136.     x0, y0, x1, y1 : integer;
  137. begin
  138.      x0 := Margin;
  139.      y0 := Margin;
  140.      x1 := ScrnPhysicalPixelWidth-Margin;
  141.      y1 := ScrnPhysicalHeight-Margin;
  142.      xrectfill(x0, y0, x1,y1,VisiblePageOffs,1);
  143.      xline(x0,y0,x1,y0,2,VisiblePageOffs);
  144.      xline(x0,y1,x1,y1,2,VisiblePageOffs);
  145.      xline(x0,y0,x0,y1,2,VisiblePageOffs);
  146.      xline(x1,y0,x1,y1,2,VisiblePageOffs);
  147.      xline(x0+2,y0+2,x1-2,y0+2,2,VisiblePageOffs);
  148.      xline(x0+2,y1-2,x1-2,y1-2,2,VisiblePageOffs);
  149.      xline(x0+2,y0+2,x0+2,y1-2,2,VisiblePageOffs);
  150.      xline(x1-2,y0+2,x1-2,y1-2,2,VisiblePageOffs);
  151.      textwindowx:=x0;
  152.      textwindowy:=y0;
  153. end;
  154.  
  155.  
  156. procedure waitforkeypress;
  157. begin
  158.     xshowmouse;
  159.     while keypressed do readkey;
  160.     while MouseButtonStatus=LeftPressed do;
  161.     palscrolldir := 1-palscrolldir;
  162.     while (not keypressed) and (MouseButtonStatus<>LeftPressed) do
  163.     begin
  164.         xrotpalstruc(pal^,palscrolldir);
  165. {$IFDEF DPMI}
  166.         mousefrozen := 1;
  167. {$ENDIF}
  168.         {Notice that there is no need to freeze and update the mouse if the
  169.          vsync handler is installed while just updating the palette, because the
  170.          DAC is changed before the mouse handler is called}
  171.  
  172.         xputpalstruc(pal^);
  173. {$IFDEF DPMI}
  174.         xupdatemouse;
  175. {$ENDIF}
  176.     end;
  177.     while keypressed do readkey;
  178.     while MouseButtonStatus=LeftPressed do;
  179. end;
  180.  
  181.  
  182. procedure quit; far;
  183. begin
  184.     xremovevsynchandler;
  185.     xmouseremove;
  186.     textmode(co80+font8x8);
  187.     ExitProc := SaveExitProc;
  188. end;
  189.  
  190. procedure intro1;
  191. begin
  192.     xsetrgb(1,40,40,40);
  193.     xsetrgb(2,63,63,0);
  194.     xsetrgb(3,63,0,0);
  195.     xsetrgb(4,0,63,0);
  196.     xsetrgb(5,0,0,63);
  197.     xsetrgb(6,0,0,28);
  198.     xsetrgb(7,0,28,0);
  199.     xsetrgb(8,28,0,0);
  200.     xsetrgb(9,0,0,38);
  201.     textwindow(20);
  202.     xsetfont(1);
  203.     xpos := xcentre(180,textwindowy+4,VisiblePageOffs,6,'XLibPas Version 2.0');
  204.     xprintf(xpos-1,textwindowy+3,VisiblePageOffs,2,'XLibPas Version 2.0');
  205.     xsetfont(0);
  206.     xpos := xcentre(180,168,VisiblePageOffs,6,'Press any key to continue');
  207.     xprintf(xpos-1,167,VisiblePageOffs,2,'Press any key to continue');
  208. end;
  209.  
  210. procedure subsequentpage;
  211. begin
  212.     xhidemouse;
  213.     textwindow(20);
  214.     xsetfont(1);
  215.     xpos := xcentre(180,textwindowy+4,VisiblePageOffs,6,'XLibPas Version 2.0');
  216.     xprintf(xpos-1,textwindowy+3,VisiblePageOffs,2,'XLibPas Version 2.0');
  217.     xsetfont(0);
  218.     xpos := xcentre(180,168,VisiblePageOffs,6,'Press any key to continue');
  219.     xprintf(xpos-1,167,VisiblePageOffs,2,'Press any key to continue');
  220.  
  221. end;
  222.  
  223. procedure loaduserfonts;
  224. var
  225.     f : File;
  226. begin
  227.     assign(f,'fonts\var6x8.fnt');
  228.     reset(f,1);
  229.     blockread( f, userfnt1^, filesize(f) );
  230.     close(f);
  231.     xregisteruserfont(userfnt1^);
  232. end;
  233.  
  234.  
  235.  
  236. procedure main;
  237. var
  238.     i, j, xinc, yinc, Margin : integer;
  239.     ch : char;
  240.     a : byte;
  241.     currx, curry : word;
  242.     x0,x1,x2,y0,y1,y2 : integer;
  243.     pt : pointer;
  244. begin
  245.     GetMem(pal,256*3);
  246.     GetMem(pal2,256*3);
  247.     GetMem(userfnt1,256*16+4);
  248.     currx := 0;
  249.     curry := 0;
  250.  
  251.     xtextmode;
  252.     xsetmode(XMODE360x200,500);
  253. {$IFNDEF DPMI}
  254.     xinstallvsynchandler(1);
  255. {$ENDIF}
  256.     xsetsplitscreen(ScrnPhysicalHeight-61);
  257.     xsetdoublebuffer(220);
  258.     xhidesplitscreen;
  259.     xtextinit;
  260.     xmouseinit;
  261.     xmousewindow(0,0,359,199);
  262.     mousecolor := 2;
  263.     for j:=0 to ScrnPhysicalHeight-1 do
  264.         xline(0,j,ScrnLogicalPixelWidth,j,16+(j mod 239),VisiblePageOffs);
  265.  
  266.     xgetpalstruc(pal^,240,16);
  267.     loaduserfonts;
  268.     intro1;
  269.     xsetfont(2);
  270.     xhidemouse;
  271.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '  Hi, folks. This is yet another FREEWARE Mode X graphics');
  272.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' library. It is by no means complete, but I believe it');
  273.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' contains a rich enough set of functions to achieve its');
  274.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' design goal : a game development oriented library for');
  275.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' Borland TP/BP programmers.');
  276.  
  277.     xprintf(textwindowx+5,50+48,VisiblePageOffs,9, '  This library comes with BP/TP sources.');
  278.     xprintf(textwindowx+5,50+56,VisiblePageOffs,9, ' It was inspired by the DDJ Graphics column and many');
  279.     xprintf(textwindowx+5,50+64,VisiblePageOffs,9, ' INTERNET and USENET authors who, unlike the majority of');
  280.     xprintf(textwindowx+5,50+72,VisiblePageOffs,9, ' programmers (you know who you are!), willingly share');
  281.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, ' their code and ideas with others.');
  282.  
  283.  
  284.     waitforkeypress;
  285.  
  286.     subsequentpage;
  287.     xsetfont(0);
  288.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'Supported 256 colour resolutions.');
  289.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'Supported 256 colour resolutions.');
  290.     xsetfont(2);
  291.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' 320x200   Standard for games       ~ 4 pages');
  292.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' 320x240   DDJ Mode X square pixels ~ 3.5 pages');
  293.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' 360x200   My favourite for games   ~ 3 pages  ');
  294.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' 360x240                            ~ 2.8 pages');
  295.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' 320x400                            ~ 2 pages  ');
  296.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' 320x480,360x400,360x480,376x282,360x360,376x308');
  297.     xprintf(textwindowx+5,50+48,VisiblePageOffs,9, ' 376x564,256x200,256x240,256x224,256x256,360x270');
  298.     xprintf(textwindowx+5,50+56,VisiblePageOffs,9, ' 400x300');
  299.     xprintf(textwindowx+5,50+72,VisiblePageOffs,9, ' Phew! and they''ll run on all VGA cards and ');
  300.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, ' monitors (some of the weird ones are best suited');
  301.     xprintf(textwindowx+5,50+88,VisiblePageOffs,9, ' to monitors with both vert & horiz adjustments)');
  302.     xprintf(textwindowx+5,50+98,VisiblePageOffs,2, '  ');
  303.     xprintf(textwindowx+5,50+106,VisiblePageOffs,2,' Overkill? Maybe!! ');
  304.  
  305.  
  306.     waitforkeypress;
  307.  
  308.     subsequentpage;
  309.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'Text display functions.');
  310.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'Text display functions.');
  311.     xsetfont(2);
  312.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   Several text printing functions are provided.');
  313.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' They support the VGA ROM 8x14 and 8x8 fonts as well');
  314.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' as user-defined fonts (like this 6x8 font).');
  315.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' A set of 70 fonts is provided, but no editor :-(');
  316.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' ( is someone out there so kind...)');
  317.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' User defined fonts may be proportionally spaced but');
  318.     xprintf(textwindowx+5,50+58,VisiblePageOffs,9, ' have a maximum width of 8 pixels.');
  319.  
  320.  
  321.     waitforkeypress;
  322.  
  323.     subsequentpage;
  324.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'Advanced screen functions.');
  325.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'Advanced screen functions.');
  326.     xsetfont(2);
  327.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   The library supports virtual screens larger');
  328.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' than the physical screen, panning of such');
  329.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' screens, and a split screen option.');
  330.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, '   These functions can be used together or');
  331.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' in isolation, and in the lower resolutions');
  332.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' double buffering can also be accomplished.');
  333.  
  334.     xrectfill(0, 0, ScrnPhysicalPixelWidth,60,SplitScrnOffs,5);
  335.     xline(0,0,ScrnPhysicalPixelWidth,0,2,SplitScrnOffs);
  336.     xsetfont(1);
  337.     xprintf(10,10,SplitScrnOffs,2, ' This is a split screen, tops for scores.');
  338.     xsetfont(0);
  339.     for i:=ScrnPhysicalHeight downto ScrnPhysicalHeight-60 do
  340.         xadjustsplitscreen(i);
  341.     xprintf(10,25,SplitScrnOffs,2, ' Even better for scrolling games etc.');
  342.  
  343.     xcpvidpage(VisiblePageOffs,HiddenPageOffs);
  344.  
  345.  
  346.     xshowmouse;
  347.     waitforkeypress;
  348.     pt := @bm2;
  349.     initobject(60,90,4, 12, -1, 1, pt );
  350.     pt := @bm;
  351.     initobject(30,30,4, 12, 1, 1, pt );
  352.     initobject(80,120,4, 12, 2, 1, pt );
  353.     initobject(300,200,4, 12, 1, -2, pt );
  354.     initobject(360,30,4, 12, -1, -1, pt );
  355.     initobject(360,10,4, 12, -2, 2, pt );
  356.  
  357.     xhidemouse;
  358.  
  359.     while (not keypressed) and (MouseButtonStatus<>LeftPressed) do
  360.     begin
  361.         animate;
  362.         if (objects[0].X>=currx+ScrnPhysicalPixelWidth-32) and
  363.             (currx < MaxScrollX) then inc(currx)
  364.         else if (objects[0].X < currx+16) and ( currx > 0) then dec(currx);
  365.         if (objects[0].Y>=curry+ScrnPhysicalHeight-92) and
  366.             (       curry < MaxScrollY) then inc(curry)
  367.         else if (objects[0].Y < curry+16) and ( curry > 0) then dec(curry);
  368.         xpageflip(currx, curry);
  369.     end;
  370.     while keypressed do readkey;
  371.     while MouseButtonStatus=LeftPressed do;
  372.  
  373.     clearobjects;
  374.     xpageflip(currx,curry);
  375.  
  376.  
  377.     xsetstartaddr(0,0);
  378.  
  379.  
  380.     for j:=0 to 3 do
  381.     begin
  382.         xhidesplitscreen;
  383.         delay(100);
  384.         xshowsplitscreen;
  385.         delay(100);
  386.     end;
  387.  
  388.  
  389.     for i:= ScrnPhysicalHeight-60 to ScrnPhysicalHeight do
  390.         xadjustsplitscreen(i);
  391.  
  392.     xhidemouse;
  393.     subsequentpage;
  394.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'Palette functions.');
  395.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'Palette functions.');
  396.     xsetfont(2);
  397.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   A number of palette manipulation functions');
  398.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' are provided. You have already seen some of');
  399.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' them in action. Another common operation is');
  400.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' palette fading.                     ');
  401.  
  402.     i:=0;
  403.     a:=255;
  404.     while (xcpcontrastpalstruc(pal^, pal2^,a))>0 do
  405.     begin
  406.         a := a-2;
  407.         xputpalstruc(pal2^);
  408.         xrotpalstruc(pal^,palscrolldir);
  409.         inc(i);
  410.     end;
  411.     for j:=0 to i-1 do
  412.     begin
  413.         xcpcontrastpalstruc(pal^, pal2^,a);
  414.         a := a+2;
  415.         xputpalstruc(pal2^);
  416.         xrotpalstruc(pal^,palscrolldir);
  417.     end;
  418.     waitforkeypress;
  419.     subsequentpage;
  420.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'XLIBC Functions!');
  421.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'XLIBC Functions!');
  422.     xsetfont(2);
  423.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' Functions include:');
  424.     xprintf(textwindowx+5,50+10,VisiblePageOffs,9, '  - FAST VRAM-based masked bitmaps, including');
  425.     xprintf(textwindowx+5,50+18,VisiblePageOffs,9, '      support for clipping regions');
  426.     xprintf(textwindowx+5,50+28,VisiblePageOffs,9, '  - FAST compiled masked bitmaps');
  427.     xprintf(textwindowx+5,50+38,VisiblePageOffs,9, '  - Planar bitmap and additional support');
  428.     xprintf(textwindowx+5,50+48,VisiblePageOffs,9, '      for clipping');
  429.     xprintf(textwindowx+5,50+58,VisiblePageOffs,9, '  - mouse module');
  430.     xprintf(textwindowx+5,50+68,VisiblePageOffs,9, '  - *FAST* filled and clipped triangles ideal for');
  431.     xprintf(textwindowx+5,50+78,VisiblePageOffs,9, '   3D work. Thanks to S. Dollins for the code.');
  432.     xprintf(textwindowx+5,50+88,VisiblePageOffs,9, '  - Filled and clipped polygons');
  433.     xprintf(textwindowx+5,50+98,VisiblePageOffs,9, '  - Virtual VSync Handler');
  434.     waitforkeypress;
  435.  
  436.     xhidemouse;
  437.     for i := 0 to 149 do
  438.     begin
  439.         xcircle(0, 0, i, 181 - i, VisiblePageOffs);
  440.         xcircle(360 - i, 0, i, i + 30, VisiblePageOffs);
  441.         xcircle(0, 200 - i, i, i + 30, VisiblePageOffs);
  442.         xcircle(360 - i, 200 - i, i, 181 - i, VisiblePageOffs);
  443.     end;
  444.     for i := 0 to 99 do
  445.         xfilledcircle(80 + i, i, 201 - (i shl 1), 30+i, VisiblePageOffs);
  446.     xshowmouse;
  447.     waitforkeypress;
  448.     subsequentpage;
  449.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'XLibPas Exclusive Functions!');
  450.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'XLibPas Exclusive Functions!');
  451.     xsetfont(2);
  452.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' Functions include:');
  453.     xprintf(textwindowx+5,50+10,VisiblePageOffs,9, '  - LZS encoding/decoding');
  454.     xprintf(textwindowx+5,50+20,VisiblePageOffs,9, '  - Archives');
  455.     xprintf(textwindowx+5,50+30,VisiblePageOffs,9, '  - Bitmap scaling');
  456.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, '  - Mouse integrated in Virtual VSync code');
  457.     xprintf(textwindowx+5,50+50,VisiblePageOffs,9, '  - GIF/BMP encoding/decoding');
  458.     xprintf(textwindowx+5,50+60,VisiblePageOffs,9, '  - XLARC, an XLA compression program');
  459.     xprintf(textwindowx+5,50+70,VisiblePageOffs,9, '  - XCONVERT, for format conversion');
  460.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, '  - Protected mode (experimental)');
  461.  
  462.     waitforkeypress;
  463.  
  464.     randomize;
  465.     xhidemouse;
  466.     while keypressed do readkey;
  467.     while MouseButtonStatus=LeftPressed do;
  468.     palscrolldir:=1-palscrolldir;
  469.     repeat
  470.  
  471.         i:=random(256);
  472.         x0:=random(ScrnLogicalPixelWidth);
  473.         x1:=random(ScrnLogicalPixelWidth);
  474.         x2:=random(ScrnLogicalPixelWidth);
  475.         y0:=random(ScrnPhysicalHeight);
  476.         y1:=random(ScrnPhysicalHeight);
  477.         y2:=random(ScrnPhysicalHeight);
  478.         xtriangle(x0,y0,x1,y1,x2,y2,i,VisiblePageOffs);
  479.     until (keypressed) or (MouseButtonStatus=LeftPressed);
  480.     while keypressed do readkey;
  481.     while (MouseButtonStatus=LeftPressed) do;
  482.  
  483.     subsequentpage;
  484.     xpos := xcentre(180,textwindowy+18,VisiblePageOffs,6,'PLEASE...');
  485.     xprintf(xpos-1,textwindowy+17,VisiblePageOffs,3,'PLEASE...');
  486.     xsetfont(2);
  487.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   Please mention my name in programs that use XLIB');
  488.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' just to make me feel it was worth the effort.');
  489.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' If you have any bug to report please feel free to');
  490.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' mail me a message. Any hints, suggestions and');
  491.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' contributions are welcome and encouraged.');
  492.     xprintf(textwindowx+5,50+52,VisiblePageOffs,9, ' I have contributed this code to the public domain.');
  493.     xprintf(textwindowx+5,50+60,VisiblePageOffs,9, '    Please respect my wishes and leave it there.');
  494.  
  495.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, '   Finally, I hope you all find this stuff useful,');
  496.     xcentre(180,50+106,VisiblePageOffs,9, ' Tristan Tarrant - tristant@cogs.susx.ac.uk');
  497.  
  498.     waitforkeypress;
  499.  
  500.     xhidemouse;
  501.  
  502.     xshiftrect (27, 27, 360-27, 177, 27, 23, VisiblePageOffs);
  503.     xrectfill(25, 173, 335, 176, VisiblePageOffs, 1);
  504.     for i := 0 to 49 do
  505.         xshiftrect (27, 26, 360-27, 177 - (i * 3), 27, 23, VisiblePageOffs);
  506. end;
  507.  
  508. begin
  509.     SaveExitProc := ExitProc;
  510.     ExitProc := @quit;
  511.     main;
  512. end.
  513.  
  514.  
  515.